SuperStrict

Framework sedm.simpleirr
Import sedm.simplenewt

Local irr:TIrrlicht = TIrrlicht.Init()

If irr
	irr.Graphics3D(800, 600, 32)
		
	Local table:TAnimMesh	= TAnimMesh.LoadAnimMesh("data/obj/table.b3d", True)
	Local kugel:TAnimMesh	= TAnimMesh.LoadAnimMesh("data/obj/kugel.b3d", True)
	Local pad:TAnimMesh		= TAnimMesh.LoadAnimMesh("data/obj/paddle.b3d", True)
		
	kugel.node.setMaterialType(EMT_REFLECTION_2_LAYER)
	
	Local cam:TCamera		= TCamera.CreateFPS()
	cam.Position(0.0, 1.0, -6.0)
	
	Local l01:TLight		= TLight.Create(LIGHT_POINT)
	Local l02:TLight		= TLight.Create(LIGHT_POINT)
	
	l01.Position(-5.0, 10.0, 10.0)
	l02.Position(5.0, 5.0, -15.0)
	l01.setRange(15.0)
	l02.setRange(15.0)
	
	l02.CastShadows(False)
	irr.AmbientLight(127, 127, 117)
	
	table.MeshLighting(False)
		
	Local phys:TWorld = TWorld.Create(irr)
	phys.setSpeed(1.0)
	phys.SetPhysicModel(1,2)
	phys.Debug = False
	
	Local table_phys:TBody	= TBodyComplexHull.Create(phys, table, True)
	Local pad_phys:TBody	= TBodyBox.Create(phys, pad.getWidth()/2, pad.getHeight()/2, pad.getDepth()/2)
	pad_phys.SetMass(200)
	pad_phys.setParent(pad)
	pad_phys.Position(0.0, 0.3, -2.0)
		
	Local test:TBody = TBodySphere.Create(phys, kugel.getWidth()/2, kugel.getHeight()/2, kugel.getDepth()/2)
	test.Position(0.0, 0.3, 0.0)
	test.SetMass(20.0)
	test.setParent(kugel)
		
	Local pad_x:Float	= pad.X()
	Local pad_y:Float	= pad.Y()
	Local pad_z:Float	= pad.Z()
			
	Repeat
		irr.RenderWorld()
		phys.UpdateWorlds()
				
		pad_phys.Position(pad_x, pad_y, pad_z)
		pad_phys.rot = _VECTOR3DF()
		
		If irr.isKeyDown(KEY_A) Then pad_x:- 0.01
		If irr.isKeyDown(KEY_D) Then pad_x:+ 0.01
		If irr.isKeyDown(KEY_W) Then pad_z:+ 0.01
		If irr.isKeyDown(KEY_S) Then pad_z:- 0.01
		
		Rem
		If irr.isKeyHit(KEY_SPACE)
			test.ApplyImpulse(kugel.X(True), 0.0, 0.0, 0.1, 0.0, 0.5)
		End If
		endrem
						
		DeltaUpDate()
	Until irr.isKeyDown(KEY_ESCAPE)	
Else
	RuntimeError("Das Irrlicht Device konnte nicht erstellt werden.")
End If

End